package com.car.customer.controller;


import com.car.customer.domain.SysCarComplaints;
import com.car.customer.service.SysCarComplaintsService;
import com.car.customer.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("complanints")
public class ComplanintsController {


    @Autowired
    SysCarComplaintsService complaintsService;


    @GetMapping("complanintsList")
    public Result complanintsList() {
        List<SysCarComplaints> list = complaintsService.complanintsList();
        return Result.success(list);
    }

    @PostMapping("complanintsInsert")
    public Result complanintsInsert(@RequestBody SysCarComplaints carComplaints) {
        Boolean bool = complaintsService.complanintsInsert(carComplaints);
        return bool?Result.success():Result.fail();
    }


    @GetMapping("complanintsDel")
    public Result complanintsDel(Integer id) {
        Boolean bool = complaintsService.complanintsDel(id);
        return bool?Result.success():Result.fail();
    }

    @PostMapping("complanintsUpdata")
    public Result complanintsUpdata(@RequestBody SysCarComplaints carComplaints) {
        Boolean bool = complaintsService.complanintsUpdata(carComplaints);
        return bool?Result.success():Result.fail();
    }
}
